package com.dawn.interestmanage.dao;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import com.dawn.interestmanage.bean.InterestinfoBean;
import com.dawn.trademanage.bean.TradeInfoBean;

 


@Repository
public class InterestinfoDao {
	@Autowired
    private HibernateTemplate hibernateTemplate;

	public List<InterestinfoBean> findAllInter(){
	        @SuppressWarnings("unchecked")
	        List<InterestinfoBean> interests = (List<InterestinfoBean>) hibernateTemplate.find("from InterestinfoBean i");
	        return interests;
	}
	  
    public List<InterestinfoBean> findInterByIid(int interestId){
        @SuppressWarnings("unchecked")
        List<InterestinfoBean> interests = (List<InterestinfoBean>) hibernateTemplate.find("from InterestinfoBean i where i.interestId = ?", interestId);
        return interests;
    }
    
    public List<InterestinfoBean> findInterByIName(String interestName) {
        @SuppressWarnings("unchecked")
        List<InterestinfoBean> users = (List<InterestinfoBean>) hibernateTemplate.find("from InterestinfoBean i where i.interestName = ?", interestName);
        return users;
    }
    
    public void addInterest(InterestinfoBean interestinfo) {   
        hibernateTemplate.save(interestinfo);  
    }
    
    public void delInterest(InterestinfoBean interestinfo) {   
        hibernateTemplate.delete(interestinfo);
    }
}
